#ifndef OSDJSON_H
#define OSDJSON_H
#include <QObject>

struct cJSON;

class OSDJson
{
public:
    explicit OSDJson();
    OSDJson(QString src);
    OSDJson(cJSON *json);

    OSDJson(const OSDJson& obj);
    ~OSDJson();

    bool isValid();
    void setJsonStr(QString str);
    QVariant value(QString key);
    OSDJson object(QString key);
    QList<OSDJson> getObjectArray();
    QList<QVariant> getValueArray();

    OSDJson& operator=(const OSDJson& cls);

    QString str();

    void insert(QString key, QVariant v);

private:
    void deleteJson();

private:
    cJSON *m_jsonObject;
    
};

#endif // OSDJSON_H
